package com.phiture.erp.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * @author YH
 * @date 2025/4/7
 */
@Getter
@AllArgsConstructor
public enum ErpMaterialAttrEnum {
    PLANNING_DOCUMENTS(1, "规划件"),
    PHANTOM(2, "虚拟件"),
    SELF_MADE_PARTS(3, "自制件"),
    PURCHASED_PARTS(4, "外购件"),
    SUBCONTRACTED_ITEM(5, "委外件"),
    OTHER(6, "其他");

    private final Integer attr;
    private final String desc;

    public static final Map<Integer, String> MATERIAL_ATTR_MAP = new HashMap<>(8);
    static {
        for (ErpMaterialAttrEnum statusEnum : ErpMaterialAttrEnum.values()) {
            MATERIAL_ATTR_MAP.put(statusEnum.attr, statusEnum.desc);
        }
    }

    public static boolean isSelfMadeParts(Integer attr){
        return SELF_MADE_PARTS.attr.equals(attr);
    }

    public static boolean isPurchasedParts(Integer attr){
        return PURCHASED_PARTS.attr.equals(attr);
    }
}
